package com.czf.testmodule.time.springtask;

import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author zfChen
 * @create 2022/6/7 11:31
 */
@Slf4j
@Component
public class CronTask {

//    @Scheduled(cron = "0/5 * * ? * ?")
//    @Scheduled(fixedRate = 5000)
    public void cron(){
        log.info("定时执行，时间{}", DateUtil.now());
        try {
            Thread.sleep(6000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

//    @Scheduled(cron = "0/1 * * ? * ?")
//    public void cron2(){
//        try {
//            Thread.sleep(6000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//    }
}
